Make multicall state per-vcpu rather than per-cpu
authorKeir Fraser <keir@xen.org>
Tue, 16 Nov 2010 13:01:43 +0000 (13:01 +0000)
committerKeir Fraser <keir@xen.org>
Tue, 16 Nov 2010 13:01:43 +0000 (13:01 +0000)
This is a prerequisite for allowing guest descheduling within a
hypercall.

Signed-off-by: Keir Fraser <keir@xen.org>
xen/arch/ia64/xen/hypercall.c
xen/arch/x86/domain.c
xen/arch/x86/x86_64/compat/mm.c
xen/common/domain.c
xen/common/multicall.c
xen/common/schedule.c
xen/include/xen/multicall.h
xen/include/xen/sched.h

index b3193228b627d772a12742c9730ce657ecbc8c3d..6ea15c290a2e607a0362435746c0fa2a7a82851f 100644 (file)
@@ -419,7 +419,7 @@ ia64_hypercall(struct pt_regs *regs)
 unsigned long hypercall_create_continuation(
        unsigned int op, const char *format, ...)
 {
-    struct mc_state *mcs = &this_cpu(mc_state);
+    struct mc_state *mcs = &current->mc_state;
     struct vcpu *v = current;
     const char *p = format;
     unsigned long arg;
index 4c7440c0e71edfe878c47e66026d231c6c8c7dbd..87439f8de9e21cd31044b73fb9d53d37d6bbd58b 100644 (file)
@@ -1556,7 +1556,7 @@ void sync_vcpu_execstate(struct vcpu *v)
 unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...)
 {
-    struct mc_state *mcs = &this_cpu(mc_state);
+    struct mc_state *mcs = &current->mc_state;
     struct cpu_user_regs *regs;
     const char *p = format;
     unsigned long arg;
@@ -1638,7 +1638,7 @@ unsigned long hypercall_create_continuation(
 int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...)
 {
     int rc = 0;
-    struct mc_state *mcs = &this_cpu(mc_state);
+    struct mc_state *mcs = &current->mc_state;
     struct cpu_user_regs *regs;
     unsigned int i, cval = 0;
     unsigned long nval = 0;
index 27b6227bfe4bb08b329a6b47bd4b49fda25234e8..453fbac1908a6b18687e8f1481a7acfb1657633e 100644 (file)
@@ -308,7 +308,7 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mmuext_op_compat_t) cmp_uops,
             if ( err == __HYPERVISOR_mmuext_op )
             {
                 struct cpu_user_regs *regs = guest_cpu_user_regs();
-                struct mc_state *mcs = &this_cpu(mc_state);
+                struct mc_state *mcs = &current->mc_state;
                 unsigned int arg1 = !test_bit(_MCSF_in_multicall, &mcs->flags)
                                     ? regs->ecx
                                     : mcs->call.args[1];
index 20e89ea00868fd2d7d084469a4d5a99030463122..69a0ab4b621c221e10feefd34942da9c3016fae7 100644 (file)
@@ -495,19 +495,6 @@ void __domain_crash_synchronous(void)
 {
     __domain_crash(current->domain);
 
-    /*
-     * Flush multicall state before dying if a multicall is in progress.
-     * This shouldn't be necessary, but some architectures are calling
-     * domain_crash_synchronous() when they really shouldn't (i.e., from
-     * within hypercall context).
-     */
-    if ( this_cpu(mc_state).flags != 0 )
-    {
-        dprintk(XENLOG_ERR,
-                "FIXME: synchronous domain crash during a multicall!\n");
-        this_cpu(mc_state).flags = 0;
-    }
-
     vcpu_end_shutdown_deferral(current);
 
     for ( ; ; )
index 7ee21b47c12e1427c24ae373d044daf5448b9e6f..58b96b28a3786572a180b6ab3a64434d938294df 100644 (file)
@@ -15,7 +15,6 @@
 #include <asm/hardirq.h>
 
 #ifndef COMPAT
-DEFINE_PER_CPU(struct mc_state, mc_state);
 typedef long ret_t;
 #define xlat_multicall_entry(mcs)
 #endif
@@ -24,7 +23,7 @@ ret_t
 do_multicall(
     XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
 {
-    struct mc_state *mcs = &this_cpu(mc_state);
+    struct mc_state *mcs = &current->mc_state;
     unsigned int     i;
 
     if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
index fcf2cf4df39ebf5396920d89510a23118c90218b..905f02f89aa2b4419ac703dd7d2e0135b8b1c935 100644 (file)
@@ -1048,7 +1048,6 @@ static void schedule(void)
     struct task_slice     next_slice;
 
     ASSERT(!in_irq());
-    ASSERT(this_cpu(mc_state).flags == 0);
 
     perfc_incr(sched_run);
 
index 34cdb4664f739ffe9c0d456f838a03872277161a..0e8d8bb0aef3b599d3bcef367654bf4e481c2cf8 100644 (file)
@@ -25,6 +25,4 @@ struct mc_state {
     };
 };
 
-DECLARE_PER_CPU(struct mc_state, mc_state);
-
 #endif /* __XEN_MULTICALL_H__ */
index ca791eb1f65d8aada9e769bcff359f404defa74b..955ec997112f912b9e39b0f51fe7baa32d1f2abf 100644 (file)
@@ -25,6 +25,7 @@
 #include <public/mem_event.h>
 #include <xen/cpumask.h>
 #include <xen/nodemask.h>
+#include <xen/multicall.h>
 
 #ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
@@ -169,6 +170,9 @@ struct vcpu
     /* Tasklet for continue_hypercall_on_cpu(). */
     struct tasklet   continue_hypercall_tasklet;
 
+    /* Multicall information. */
+    struct mc_state  mc_state;
+
     struct arch_vcpu arch;
 };